#{extends 'main.html' /}
<div class="page-group">
    <div class="page page-current" id="work-order-list">
        <header class="bar bar-nav">
            <a href="/" class="icon icon-left pull-left"></a>
            <h1 class="title">查看工单</h1>
        </header>
        <section class="repairList content scroll_y">
            <div class="list-block">
                #{ifnot issueList}
                    <ul>
                            <li class="item-content">
                                您当前没有工单
                            </li>
                    </ul>
                #{/ifnot}
                <ul>
                    #{list issueList , as :'issue'}
                    <li class="item-content">
                        <div class="item-inner">
                            <div class="item-title"><a href="/workorder/detail/${issue?.id}">${issue?.issueName}</a></div>
                            <div class="item-after">${issue?.createdAt?.format('yyyy-MM-dd')}</div>
                        </div>
                    </li>
                    #{/list}
                </ul>
            </div>
        </section>

    #{include 'weixin/footer.html'/}


    </div>
</div>

<script type="text/javascript">
    $(function() {
        $(document).on('click','.sub_btn', function () {
            $.showPreloader();
            var name = $('#name').val();
            var phone = $('#phone').val();
            var cardNumber = $('#cardNumber').val();
            var identityCard = $('#identityCard').val();
            $.getJSON("/accesscard/bind",{name : name , phone : phone , cardNumber : cardNumber , identityCard : identityCard},
                    function (data) {
                        $.hidePreloader();
                        if(data.success) {
                            $.router.back();
                        } else {
                            $.toast(data.msg);
                        }
                    })
        });

        $(document).on("pageInit", function(e, pageId, $page) {
            if(pageId == "work-order-detail") {
                var name_ = $("#work-detail-name").html();
                if(name_.indexOf(",") != -1){
                    var room_ = name_.split(",")[0];
                    var type_ = name_.split(",")[1];
                    $("#work-detail-name").html(room_);
                    $("#work-detail-name").parent().after($("<li> <h3>"+type_+"</h3></li>"));
                }

                var time_ = $("#work-detial-time").html();
                if(time_.indexOf("~") != -1){
                    var start_ = time_.split("~")[0];
                    var end_ = time_.split("~")[1];
                    var date_ = start_.split(" ")[0];
                    var startHour = parseInt(start_.split(" ")[1].split(".")[0]);
                    var endHour = parseInt(end_.split(" ")[1].split(".")[0]);
                    $("#work-detial-time").html(date_ +"&nbsp;&nbsp;&nbsp;"+startHour+"点-"+endHour+"点");
                }
            }
        });

        $.init();
        $(".lunbo").swiper({
            autoplay: 3000  //可选选项，自动滑动
        });

        // 检测高度

        $(".content").on("scroll",function(){
            if($('.content').scrollTop() > 100){
                $('.bar-nav0').addClass("active");
            }else {
                $('.bar-nav0').removeClass("active");
            }
        });
    })
</script>